//Create function option
function SubFunc2View(vWidth) {
    // Create a TableView.
    var self = Ti.UI.createTableView();
    self.backgroundColor = 'transparent';
    self.separatorColor = 'transparent';
    var rowTop = Ti.UI.createTableViewRow({
        height: '30'
    });
    var rowFunctionTitle = Ti.UI.createTableViewRow({
        height: 'auto'
    });
    var lblFunction = Ti.UI.createLabel({
        text: '',
        color: 'white',
        font: {
            fontSize: 20
        },
        height: 50,
        width: '90%',
        textAlign: 'center'
    });
    rowFunctionTitle.add(lblFunction);
    var rowFunction1 = Ti.UI.createTableViewRow({
        height: 'auto'
    });
    var btnFunc21 = Ti.UI.createButton({
        title: 'Buyer\'s Stamp Duty',
        width: '90%',
        id:'btnFunc21'
    });
    var testView21 = Ti.UI.createView();
    testView21.add(btnFunc21);
    // Listen for click events.
    // btnFunc21.addEventListener('click', function () {
        // btnFunc21Press();
    // });
    rowFunction1.add(testView21);
    
    var rowFunction2 = Ti.UI.createTableViewRow({
        height: 'auto'
    });
    var btnFunc22 = Ti.UI.createButton({
        title: 'Seller\'s Stamp Duty',
        width: '90%',
        id:'btnFunc22'
    });
    // Listen for click events.
    // btnFunc22.addEventListener('click', function () {
        // btnFunc22Press();
    // });
    var testView22 = Ti.UI.createView();
    testView22.add(btnFunc22);
    rowFunction2.add(testView22);
    
    var rowBlank = Ti.UI.createTableViewRow({
        height: '30'
    });
    // Populate the TableView data.
    var data = [
    rowTop, rowFunctionTitle, rowBlank, rowFunction1, rowBlank, rowFunction2];
    self.setData(data);
	self.addEventListener('click', function (e) {
        if (e.source.id.toString().indexOf('btnFunc') === 0) {
        	btnFunc21Press();
        } else{
        	if (e.source.id === 'btnFunc22') {
        		btnFunc22Press();
        	};
        };
    });
    function btnFunc21Press() {
        Ti.App.fireEvent('chooseFunction', {
            info: 4
        });
    }

    function btnFunc22Press() {
        Ti.App.fireEvent('chooseFunction', {
            info: 5
        });
    }
    return self;
}
module.exports = SubFunc2View;